﻿using System;
using Bank.Services;
using System.Diagnostics.Contracts;

namespace Bank.Operations
{
    public class InPayment : Operation
    {
        decimal _amountInPayment;

        public InPayment(Decimal amountInPayment)
        {
            Contract.Requires(amountInPayment > 0);

            _amountInPayment = amountInPayment;
        }


        public InPayment(Money amountInPayment)
        {
            Contract.Requires(amountInPayment.Kwota > 0);

            _amountInPayment = amountInPayment.Kwota;
        }


        public InPayment(IOperationLogger operationLogger)
        {
            _operationLogger = operationLogger;
        }

        public override void ExecuteOperation(IAccount account)
        {
            account.Ballance += _amountInPayment;

            base.ExecuteOperation(account);
            
        }

        public override void ExecuteOperation2(IAccount account)
        {
            account.Ballance += _amountInPayment;

            base.ExecuteOperation2(account);

        }

        public override string GetOperationName()
        {
            return GetType().Name;
        }
    }
}
